/**
 * @param {number[]} heights
 * @param {number} cnt
 * @return {number[]}
 */
 var analysisHistogram = function(heights, cnt) {
  heights.sort((a,b) => a-b)
  const n = heights.length
  let diff = Infinity
  let ans = [0, cnt-1]
  for(let r = cnt-1; r<n; r++){
    if(heights[r] - heights[r-cnt+1] < diff){
      diff = heights[r] - heights[r-cnt+1]
      ans = [r-cnt+1, r]
    }
  }
  return heights.slice(ans[0], ans[1]+1)
};